home *** CD-ROM | disk | FTP | other *** search
- Path: mail2news.demon.co.uk!genesis.demon.co.uk
- From: Lawrence Kirby <fred@genesis.demon.co.uk>
- Newsgroups: comp.lang.c
- Subject: Re: Array Parameters
- Date: Wed, 03 Jan 96 20:41:35 GMT
- Organization: none
- Message-ID: <820701694snz@genesis.demon.co.uk>
- References: <wayne.820650643@hawk> <4ce349$4j9@hacgate2.hac.com>
- Reply-To: fred@genesis.demon.co.uk
- X-NNTP-Posting-Host: genesis.demon.co.uk
- X-Newsreader: Demon Internet Simple News v1.27
- X-Mail2News-Path: genesis.demon.co.uk
-
- In article <4ce349$4j9@hacgate2.hac.com>
- collins@thor.tu.hac.com "Ron Collins" writes:
-
- >: void test(int num, char ** maps)
- > ^^^^^^^^^^^^
- >
- >Change this to
- >
- > void test(int num, char*maps[])
-
- No need - the rewrite rule for function parameters makes these entirely
- equivalent.
-
- >While there are circumstances where an array may behave as a pointer,
-
- That path leads to confusion. There are no circumstances where an array
- may behave as a pointer, however in the context of an expression the
- 'value' of an array is a pointer to its first element. It is impossible
- to specify an array as a function parameter since, as in the example above,
- the compiler 'rewrites' the parameter declaration in terms of a pointer,
- i.e. the parameter is truely declared as a pointer and within the function
- body behaves just like any other pointer.
-
- --
- -----------------------------------------
- Lawrence Kirby | fred@genesis.demon.co.uk
- Wilts, England | 70734.126@compuserve.com
- -----------------------------------------
-